//
// Created by jsjxsy on 2022/8/18.
// + - * / % 可以作为成员函数或者非成员函数(友元函数)
//
#include <iostream>
using namespace std;
class Point {
 public:
  Point(int x = 0, int y = 0) : x(x), y(y) {
    cout << "construct Point(x=" << x << ",y=" << y << ")" << endl;
  }

  Point operator+(const Point &other) const {
    return Point(x + other.x, y + other.y);
  };

  int x;
  int y;
};

int main() {
  Point p1(1, 1);
  Point p2(3, 5);
  Point p3;
  p3 = p1 + p2;
  cout << "p3(x=" << p3.x << ",y=" << p3.y << ")" << endl;
  return 0;
}
